﻿<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="log4net"
                 type="log4net.Config.Log4NetConfigurationSectionHandler" />
    </configSections>
    <log4net>
        <root>
            <level value="ALL" />
            <appender-ref ref="AdoNetAppender" />
            <!--<appender-ref ref="ConsoleAppender" />-->
            <appender-ref ref="FileAppender" />
        </root>
        <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
            <bufferSize value="1" />
            <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <connectionString value="data source=hds-087.hichina.com;initial catalog=hds0871089_db;integrated security=false;persist security info=True;User ID=hds0871089;Password=hya0114145520" />
            <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)" />
            <parameter>
                <parameterName value="@log_date" />
                <dbType value="DateTime" />
                <layout type="log4net.Layout.RawTimeStampLayout" />
            </parameter>
            <parameter>
                <parameterName value="@thread" />
                <dbType value="String" />
                <size value="255" />
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%thread" />
                </layout>
            </parameter>
            <parameter>
                <parameterName value="@log_level" />
                <dbType value="String" />
                <size value="50" />
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%level" />
                </layout>
            </parameter>
            <parameter>
                <parameterName value="@logger" />
                <dbType value="String" />
                <size value="255" />
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%logger" />
                </layout>
            </parameter>
            <parameter>
                <parameterName value="@message" />
                <dbType value="String" />
                <size value="4000" />
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%message" />
                </layout>
            </parameter>
            <parameter>
                <parameterName value="@exception" />
                <dbType value="String" />
                <size value="4000" />
                <layout type="log4net.Layout.ExceptionLayout" />
            </parameter>
        </appender>
        <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="[时间:%date]%newline[级别:%level]%newline[命名空间:%C]%newline[方法:%M]%newline[文件名:%F]%newline[行数:%l]%newline[线程名:%t]%newline[logger:%M]%newline[消息:%message]%newline%newline" />
            </layout>
        </appender>
        <appender name="FileAppender" type="log4net.Appender.FileAppender">
            <file value="logs\log-file.txt" />
            <appendToFile value="true" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="[时间:%date]%newline[级别:%level]%newline[命名空间:%C]%newline[方法:%M]%newline[文件名:%F]%newline[行数:%l]%newline[线程名:%t]%newline[logger:%M]%newline[消息:%message]%newline%newline" />
            </layout>
        </appender>
    </log4net>
</configuration>